<?php
class My_Page extends My_Db_Page
{
    protected $pageArray = array();
    protected $pageHtmlArray = array();
    protected $span = "";
    protected $a = "";
    protected $htmlList = "";
    public $thisPage = 0;
    public $previous;
    public $next;
    public function __construct ()
    {
        return $this->toArray();
    }
    public function toHtml ()
    {
        $this->pageArray = $this->toArray();
        //
        $this->previous = $this->pageArray[$this->thisPage - 1]["url"];
        if ($this->previous != "") {
            $this->span = new My_Html_Span("<< Previous");
            $this->a = new My_Html_A($this->span->html, $this->previous, "Go To Previous");
            $this->pageHtmlArray[] = $this->a->html;
        }
        //
        for ($i = 0; $i < count($this->pageArray); $i ++) {
            $this->span = new My_Html_Span($this->pageArray[$i]["name"]);
            if ($this->thisPage + 1 == $this->pageArray[$i]["name"]) {
                $this->pageHtmlArray[] = $this->span->html;
            } else {
                $this->a = new My_Html_A($this->span->html, $this->pageArray[$i]["url"], "Go to " . $this->pageArray[$i]["name"]);
                $this->pageHtmlArray[] = $this->a->html;
            }
        }
        //
        $this->next = $this->pageArray[$this->thisPage + 1]["url"];
        if ($this->next != "") {
            $this->span = new My_Html_Span("Next >>");
            $this->a = new My_Html_A($this->span->html, $this->next, "Go To Next");
            $this->pageHtmlArray[] = $this->a->html;
        }
        //
        $this->htmlList = new Zend_View_Helper_HtmlList();
        return $this->htmlList->htmlList($this->pageHtmlArray, false, false, false);
    }
}
?>